home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 7
/
Apprentice-Release7.iso
/
Environments
/
Small Eiffel 0.4.8
/
lib_rand
/
gen_rand.e
< prev
next >
Wrap
Text File
|
1997-04-13
|
1KB
|
62 lines
-- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
-- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
--
deferred class GEN_RAND
--
-- Here is the common way to use a random number generator.
-- Current implementations are MIN_STAND, STD_RAND.
--
feature {NONE} -- Creation procedures:
make is
-- Create the generator with an automatic setting
-- of `seed_value' (Automatic setting is done using
-- internal address of Current for example).
deferred
end;
with_seed(seed_value: INTEGER) is
-- Create the generator with an explicit `seed_value'.
deferred
end;
feature
next is
-- Compute next random number in sequence.
deferred
end;
feature -- No modifications :
last_double: DOUBLE is
-- Look at the last computed number.
-- Range 0 to 1;
do
Result := last_real.to_double;
ensure
Result > 0 and Result < 1
end;
last_real: REAL is
-- Look at the last computed number.
-- Range 0 to 1;
deferred
ensure
Result > 0 and Result < 1
end;
last_integer(n:INTEGER):INTEGER is
-- Look the last computed number.
-- Range 1 to `n'.
require
n >= 1
deferred
ensure
1 <= Result and Result <= n
end;
end -- GEN_RAND